import React from "react";
import useGetData from '@hooks/useGetData';
import { Spin } from 'antd';

export function AdmissionBrochureComponent({ pageid }) {
  const apiUrl = `/api/school/get_all_brochure/${pageid}`
  const [brochureData, brochureDataloading] = useGetData(apiUrl);

  return (
    <>
      <h2 className="text-2xl font-bold my-10">招生简章列表</h2>
      <Spin spinning={brochureDataloading}>
        <ul className="divide-y font-lg divide-gray-200 leading-6">
          {brochureData.map((brochure) => (
            <li key={brochure.id} className="py-2 flex justify-between items-center">
              <a href={`/#/brochure/${brochure.id}`} className="truncate w-3/4">
                {brochure.title}
              </a>
              <span className="text-right text-gray-500">{brochure.create_date}</span>
            </li>
          ))}
        </ul>
      </Spin>

    </>

  );
}
